import java.util.Arrays;

public class J092201 {
    public static void countSort(int[] nums){
        int max = findMax(nums);
        int mix = findMIx(nums);
        int[] count_nums = new int[max - mix + 1];
        for(int i = 0; i < nums.length; i++){
            count_nums[nums[i] - mix]++;
        }
        int k = 0;
        for(int j = 0; j < count_nums.length; j++){
            while(count_nums[j] > 0){
                nums[k++] = j + mix;
                count_nums[j]--;
            }
        }
    }
    public static int findMax(int[] nums){
        int i = 0;
        int max = nums[0];
        while(i < nums.length){
            if(nums[i] > max){
                max = nums[i];
            }
            i++;
        }
        return max;
    }
    public static int findMIx(int[] nums){
        int i = 0;
        int mix = nums[0];
        while(i < nums.length){
            if(nums[i] < mix){
                mix = nums[i];
            }
            i++;
        }
        return mix;
    }
    public static void main(String[] args) {
        int[] nums = new int[]{5,2,13,4,15,6,16,7,18,9,1,12,2,13,3,14,4,15,5,16,6,17,7,18,8,19};
        countSort(nums);
        System.out.println(Arrays.toString(nums));
    }
}
